/**
 * 获取当前时间
 */

const getCurrentTime = () => {
    const date = new Date()
    const year = date.getFullYear()
    let month = fillZero(date.getMonth() + 1)
    let day = fillZero(date.getDate())
    let hour = fillZero(date.getHours())
    let min = fillZero(date.getMinutes())
    let sec = fillZero(date.getSeconds())

    return `${year}-${month}-${day} ${hour}:${min}:${sec}`
}

const fillZero = (str) => {
    str = '0' + str
    return str.slice(-2)
}

module.exports = {
    getCurrentTime
}